package cn.qihang.ssm.controller;

import cn.qihang.ssm.pojo.SysLog;
import cn.qihang.ssm.service.SysLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: qihang
 * @Date: 2022/11/9 12:50
 * @Desc:
 */
@Component
@Aspect
@Controller
@RequestMapping("sysLog")
public class LogAopController {
    @Autowired
    private SysLogService sysLogService;

    @RequestMapping("findAll")
    public String findAllSysLog(Model model,
                                @RequestParam("page")Integer page,
                                @RequestParam("size") Integer size) {

        PageHelper.startPage(page,size);
        List<SysLog> sysLogList =  sysLogService.findAll();
        PageInfo pageInfo = new PageInfo(sysLogList);
        model.addAttribute("pageInfo", pageInfo);
        return "syslog-list";
    }
}
